<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Examine/loan',array('type'=>$type))}">初次已放款列表</a></li>
			<li class="active"><a>查看</a></li>
		</ul>
        <form class="form-horizontal js-ajax-form" action="{:U('Examine/save',array('type'=>$type))}" method="post">
			<fieldset>
				<div class="tabbable">
					<div class="tab-content">
						
							<fieldset>
								<div class="control-group">
									<label class="control-label">姓名</label>
									<php>$ds=array('0'=>'<span style="color:red">未认证</span>','1'=>'<span style="color:green">已认证</span>','2'=>'<span style="color:red">认证未通过</span>','3'=>'<span style="color:red">暂时不需要</span>')</php>
									<div class="controls">
										<input type="text" disabled value="{$order.name}"><span class="form-required">*  状态 
										{$ds[$order['account_status']]}</span>
										<input type="hidden" name="options[id]" value="{$order.id}">
										<input type="hidden" name="options[user_id]" value="{$order.user_id}">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">手机号码</label>
									<div class="controls">
										<input type="text" value="{$order.mobile}" disabled>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">借款金额</label>
									<div class="controls">
										<php>$amount_list=get_amount_list();</php>
										<select name="options[amount]" id='amount' onchange='ck()'>
											<foreach name="amount_list" item="vo">
											<php>$tpl_selected=($order['amount']==$vo['amount'] && $order['interest']==$vo['interest'] && $order['examine']==$vo['examine'] && $order['consulting']==$vo['consulting'])?"selected":"";</php>
											<option {$tpl_selected} value="{$vo.id}">{$vo.name}</option>
											</foreach>
										</select>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">借款天数</label>
									<div class="controls">
										<select name="options[loan_day]">
											<php>$tpl_selected=$order['loan_day']=='7'?"selected":"";</php>
											<option {$tpl_selected} value="1">7</option>
											<php>$tpl_selected=$order['loan_day']=='14'?"selected":"";</php>
											<option {$tpl_selected} value="2">14</option>
											<php>$tpl_selected=$order['loan_day']=='21'?"selected":"";</php>
											<option {$tpl_selected} value="3">21</option>
											<php>$tpl_selected=$order['loan_day']=='28'?"selected":"";</php>
											<option {$tpl_selected} value="4">28</option>
										</select>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">分期数</label>
									<div class="controls">
										<select name="options[stages]">
											<php>$tpl_selected=$order['stages']=='1'?"selected":"";</php>
											<option {$tpl_selected} value="1">1</option>
											<php>$tpl_selected=$order['stages']=='2'?"selected":"";</php>
											<option {$tpl_selected} value="2">2</option>
											<php>$tpl_selected=$order['stages']=='3'?"selected":"";</php>
											<option {$tpl_selected} value="3">3</option>
											<php>$tpl_selected=$order['stages']=='4'?"selected":"";</php>
											<option {$tpl_selected} value="4">4</option>
										</select>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">咨询费</label>
									<div class="controls"><input type="text" name="options[interest]" id='zxf' value="{$order.interest}" disabled></div>
								</div>
								<div class="control-group">
									<label class="control-label">审核费</label>
									<div class="controls"><input type="text" name="options[examine]" id='shf' value="{$order.examine}" disabled></div>
								</div>
								<div class="control-group">
									<label class="control-label">顾问费</label>
									<div class="controls"><input type="text" name="options[consulting]" id='gwf' value="{$order.consulting}" disabled></div>
								</div>
								<div class="control-group">
									<label class="control-label">到期应还</label>
									<div class="controls"><input type="text" id='dqf' value="{$order.loan_amount}" disabled></div>
								</div>
								<if condition="($log neq null)">
								<div class="control-group">
									<label class="control-label">审核信息</label>
									<div class="controls">
									<label class="control-label" style="width:auto">
										<table border="1" style='text-align:center;width:800px' cellpadding='10px'>
											<tr>
												<th>审核类型</th>
												<th>审核时间</th>
												<th>审核人</th>
												<th>审核备注</th>
												<th>审核操作</th>
											</tr>
											<php>$stu_type=array('1'=>'借款中','2'=>'已还款','3'=>'逾期','4'=>'已到期','5'=>'审核中','6'=>'审核不通过','7'=>'驳回','8'=>'放款成功','9'=>'放款不成功','10'=>'待放款');
											$stu_ty=array('0'=>'用户审核','1'=>'订单审核','2'=>'用户信息审核','3'=>'续期审核','4'=>'逾期还款(本金)','5'=>'逾期还款','6'=>'订单审核');
											</php>
											<foreach name="log" item="vo">
												<neq name="vo.types" value="2">
												<tr>
													<td>{$stu_ty[$vo['types']]}</td>
													<td>{$vo.crtime}</td>
													<td>{$users[$vo['examine_id']]}</td>
													<td>{$vo.message}</td>
													<td>{$vo['status']?'审核成功':'审核失败'}</td>
												</tr>
												</neq>
											</foreach>
										</table>
									</label>
									</div>
								</div>
								</if>
								<if condition="($logs)">
								<div class="control-group">
									<label class="control-label">客户审核信息</label>
									<div class="controls">
									<label class="control-label" style="width:auto">
										<table border="1" style='text-align:center;width:800px' cellpadding='10px'>
											<tr>
												<th>审核类型</th>
												<th>审核时间</th>
												<th>审核人</th>
												<th>审核备注</th>
												<th>审核操作</th>
											</tr>
											<php>$stu_type=array('1'=>'借款中','2'=>'已还款','3'=>'逾期','4'=>'已到期','5'=>'审核中','6'=>'审核不通过','7'=>'驳回','8'=>'放款成功','9'=>'放款不成功','10'=>'待放款');
											$stu_ty=array('0'=>'用户审核','1'=>'订单审核','2'=>'用户信息审核','3'=>'续期审核','4'=>'逾期还款(本金)','5'=>'逾期还款','6'=>'订单审核');
											</php>
											<foreach name="logs" item="vo">
												<tr>
													<td>{$stu_ty[$vo['types']]}</td>
													<td>{$vo.crtime}</td>
													<td>{$users[$vo['examine_id']]}</td>
													<td>{$vo.message}</td>
													<td>{$vo['status']?'审核成功':'审核失败'}</td>
												</tr>
											</foreach>
										</table>
									</label>
									</div>
								</div>
								</if>
							</fieldset>
					</div>
				</div>

			</fieldset>
		</form>
		
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
</body>
<script type="text/javascript">
	var ajaxForm_list = $('form.js-ajax-form');
	if (ajaxForm_list.length) {
	    Wind.use('ajaxForm', 'artDialog', function () {
			
	        $('button.js-ajax-submit').bind('click', function (e) {

	            e.preventDefault();
	            /*var btn = $(this).find('button.js-ajax-submit'),
						form = $(this);*/
	            var btn = $(this),
	                form = btn.parents('form.js-ajax-form');
	
	            //批量操作 判断选项
	            if (btn.data('subcheck')) {
	                btn.parent().find('span').remove();
					var msg = btn.data('msg');
					if (msg) {
						art.dialog({
							id: 'warning',
							icon: 'warning',
							content: btn.data('msg'),
							cancelVal: "{:L('CLOSE')}",
							cancel: function () {
								
							},
							button :[ {
											name : "{:L('OK')}",
											callback:function(){
												ajaxSubmit(btn.data('types'));
											},
											focus : true
									} ]
						});
					} else {
						btn.data('subcheck', false);
						btn.click();
					}
	                return false;
	            }
	        });
	
	    });
	}
	function ajaxSubmit(type){
			var btn = $('button.js-ajax-submit'),
			form = btn.parents('form.js-ajax-form');
			form.ajaxSubmit({
	                url: type ? btn.data('action') : form.attr('action'),
	                //按钮上是否自定义提交地址(多按钮情况)
	                dataType: 'json',
	                beforeSubmit: function (arr, $form, options) {
						var tx=type ? '审核通过' : '审核不通过';
	                    //按钮文案、状态修改
	                    btn.text(tx + '中...').attr('disabled', true).addClass('disabled');
	                },
	                success: function (data, statusText, xhr, $form) {
	                    //按钮文案、状态修改
	                    btn.removeClass('disabled').parent().find('span').remove();
	
	                    if (data.state === 'success') {
	                        $('<span class="tips_success">' + data.info + '</span>').appendTo(btn.parent()).fadeIn('slow').delay(1000).fadeOut(function () {
	                            if (data.referer) {
	                                //返回带跳转地址
	                                if (window.parent.art) {
	                                    //iframe弹出页
	                                    window.parent.location.href = data.referer;
	                                } else {
	                                    window.location.href = data.referer;
	                                }
	                            } else {
	                                if (window.parent.art) {
	                                    reloadPage(window.parent);
	                                } else {
	                                    //刷新当前页
	                                    reloadPage(window);
	                                }
	                            }
	                        });
	                    } else if (data.state === 'fail') {
	                        $('<span class="tips_error">' + data.info + '</span>').appendTo(btn.parent()).fadeIn('fast');
	                        btn.removeProp('disabled').removeClass('disabled');
	                    }
	                }
	            });
	}
	function ck(){
	
	}
}
	</script>
</html>